home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / cclimber.c < prev    next >
C/C++ Source or Header  |  2000-05-04  |  55KB  |  1,441 lines

  1. /***************************************************************************
  2.  
  3. Crazy Climber memory map (preliminary)
  4. as described by Lionel Theunissen (lionelth@ozemail.com.au)
  5.  
  6. Crazy Kong is very similar to Crazy Climber, there is an additional ROM at
  7. 5000-5fff and RAM is at 6000-6bff. Dip switches and input connections are
  8. different as well.
  9.  
  10. Swimmer is similar but also different (e.g. it has two CPUs and two 8910,
  11. graphics are 3bpp instead of 2)
  12.  
  13. 0000h-4fffh ;20k program ROMs. ROM11=0000h
  14.                                ROM10=1000h
  15.                                ROM09=2000h
  16.                                ROM08=3000h
  17.                                ROM07=4000h
  18.  
  19. 8000h-83ffh ;1k scratchpad RAM.
  20. 8800h-88ffh ;256 bytes Bigsprite RAM.
  21. 9000h-93ffh ;1k screen RAM.
  22. 9800h-981fh ;Column smooth scroll position. Corresponds to each char
  23.              column.
  24.  
  25. 9880h-989fh ;Sprite controls. 8 groups of 4 bytes:
  26.   1st byte; code/attribute.
  27.             Bits 0-5: sprite code.
  28.             Bit    6: x invert.
  29.             Bit    7: y invert.
  30.   2nd byte ;color.
  31.             Bits 0-3: colour. (palette scheme 0-15)
  32.             Bit    4: 0=charset1, 1 =charset 2.
  33.   3rd byte ;y position
  34.   4th byte ;x position
  35.  
  36. 98dc        bit 0  big sprite priority over sprites? (1 = less priority)
  37. 98ddh ;Bigsprite colour/attribute.
  38.             Bit 0-2: Big sprite colour.
  39.             bit 3  ??
  40.             Bit   4: x invert.
  41.             Bit   5: y invert.
  42. 98deh ;Bigsprite y position.
  43. 98dfh ;Bigsprite x position.
  44.  
  45. 9c00h-9fffh ;1/2k colour RAM: Bits 0-3: colour. (palette scheme 0-15)
  46.                               Bit    4: 0=charset1, 1=charset2.
  47.                               Bit    5: (not used by CC)
  48.                               Bit    6: x invert.
  49.                               Bit    7: y invert. (not used by CC)
  50.  
  51. a000h ;RD: Player 1 controls.
  52.             Bit 0: Left up
  53.                 1: Left down
  54.                 2: Left left
  55.                 3: Left right
  56.                 4: Right up
  57.                 5: Right down
  58.                 6: Right left
  59.                 7: Right right
  60.  
  61. a000h ;WR: Non Maskable interrupt.
  62.             Bit 0: 0=NMI disable, 1=NMI enable.
  63.  
  64. a001h ;WR: Horizontal video direction (Crazy Kong sets it to 1).
  65.             Bit 0: 0=Normal, 1=invert.
  66.  
  67. a002h ;WR: Vertical video direction (Crazy Kong sets it to 1).
  68.             Bit 0: 0=Normal, 1=invert.
  69.  
  70. a004h ;WR: Sample trigger.
  71.             Bit 0: 0=Trigger.
  72.  
  73. a800h ;RD: Player 2 controls (table model only).
  74.             Bit 0: Left up
  75.                 1: Left down
  76.                 2: Left left
  77.                 3: Left right
  78.                 4: Right up
  79.                 5: Right down
  80.                 6: Right left
  81.                 7: Right right
  82.  
  83.  
  84. a800h ;WR: Sample rate speed.
  85.               Full byte value (0-255).
  86.  
  87. b000h ;RD: DIP switches.
  88.             Bit 1,0: Number of climbers.
  89.                      00=3, 01=4, 10=5, 11=6.
  90.             Bit   2: Extra climber bonus.
  91.                      0=30000, 1=50000.
  92.             Bit   3: 1=Test Pattern
  93.             Bit 5,4: Coins per credit.
  94.                      00=1, 01=2, 10=3 11=4.
  95.             Bit 7,6: Plays per credit.
  96.                      00=1, 01=2, 10=3, 11=Freeplay.
  97.  
  98. b000h ;WR: Sample volume.
  99.             Bits 0-5: Volume (0-31).
  100.  
  101. b800h ;RD: Machine switches.
  102.             Bit 0: Coin 1.
  103.             Bit 1: Coin 2.
  104.             Bit 2: 1 Player start.
  105.             Bit 3: 2 Player start.
  106.             Bit 4: Upright/table select.
  107.                    0=table, 1=upright.
  108.  
  109.  
  110. I/O 8  ;AY-3-8910 Control Reg.
  111. I/O 9  ;AY-3-8910 Data Write Reg.
  112. I/O C  ;AY-3-8910 Data Read Reg.
  113.         Port A of the 8910 selects the digital sample to play
  114.  
  115. Changes:
  116. 25 Jan 98 LBO
  117.         * Added support for the real Swimmer bigsprite ROMs, courtesy of Gary Walton.
  118.         * Increased the IRQs for the Swimmer audio CPU to 4 to make it more "jaunty".
  119.           Not sure if this is accurate, but it should be closer.
  120. 3 Mar 98 LBO
  121.         * Added alternate version of Swimmer.
  122.  
  123. TODO:
  124.         * Verify timings of sound/music on Swimmer.
  125.  
  126. ***************************************************************************/
  127.  
  128. #include "driver.h"
  129. #include "vidhrdw/generic.h"
  130.  
  131.  
  132.  
  133. extern unsigned char *cclimber_bsvideoram;
  134. extern size_t cclimber_bsvideoram_size;
  135. extern unsigned char *cclimber_bigspriteram;
  136. extern unsigned char *cclimber_column_scroll;
  137. WRITE_HANDLER( cclimber_flipscreen_w );
  138. WRITE_HANDLER( cclimber_colorram_w );
  139. WRITE_HANDLER( cclimber_bigsprite_videoram_w );
  140. void cclimber_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
  141. int cclimber_vh_start(void);
  142. void cclimber_vh_stop(void);
  143. void cclimber_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  144.  
  145. WRITE_HANDLER( cclimber_sample_select_w );
  146. WRITE_HANDLER( cclimber_sample_trigger_w );
  147. WRITE_HANDLER( cclimber_sample_rate_w );
  148. WRITE_HANDLER( cclimber_sample_volume_w );
  149. int cclimber_sh_start(const struct MachineSound *msound);
  150. void cclimber_sh_stop(void);
  151.  
  152.  
  153.  
  154. static void cclimber_init_machine (void)
  155. {
  156.     /* Disable interrupts, River Patrol / Silver Land needs this */
  157.     interrupt_enable_w(0, 0);
  158. }
  159.  
  160.  
  161.  
  162. /* Note that River Patrol reads/writes to a000-a4f0. This is a bug in the code.
  163.    The instruction at 0x0593 should say LD DE,$8000 */
  164.  
  165. static struct MemoryReadAddress readmem[] =
  166. {
  167.     { 0x0000, 0x5fff, MRA_ROM },
  168.     { 0x6000, 0x6bff, MRA_RAM },    /* Crazy Kong only */
  169.     { 0x8000, 0x83ff, MRA_RAM },
  170.     { 0x8800, 0x8bff, MRA_RAM },
  171.     { 0x9000, 0x93ff, MRA_RAM },    /* video RAM */
  172.     { 0x9800, 0x9bff, MRA_RAM },    /* column scroll registers */
  173.     { 0x9c00, 0x9fff, MRA_RAM },    /* color RAM */
  174.     { 0xa000, 0xa000, input_port_0_r },     /* IN0 */
  175.     { 0xa800, 0xa800, input_port_1_r },     /* IN1 */
  176.     { 0xb000, 0xb000, input_port_2_r },     /* DSW */
  177.     { 0xb800, 0xb800, input_port_3_r },     /* IN2 */
  178.     { -1 }  /* end of table */
  179. };
  180.  
  181. static struct MemoryWriteAddress writemem[] =
  182. {
  183.     { 0x0000, 0x5fff, MWA_ROM },
  184.     { 0x6000, 0x6bff, MWA_RAM },    /* Crazy Kong only */
  185.     { 0x8000, 0x83ff, MWA_RAM },
  186.     { 0x8800, 0x88ff, cclimber_bigsprite_videoram_w, &cclimber_bsvideoram, &cclimber_bsvideoram_size },
  187.     { 0x8900, 0x8bff, MWA_RAM },  /* not used, but initialized */
  188.     { 0x9000, 0x93ff, videoram_w, &videoram, &videoram_size },
  189.     { 0x9400, 0x97ff, videoram_w }, /* mirror address, used by Crazy Climber to draw windows */
  190.     /* 9800-9bff and 9c00-9fff share the same RAM, interleaved */
  191.     /* (9800-981f for scroll, 9c20-9c3f for color RAM, and so on) */
  192.     { 0x9800, 0x981f, MWA_RAM, &cclimber_column_scroll },
  193.     { 0x9880, 0x989f, MWA_RAM, &spriteram, &spriteram_size },
  194.     { 0x98dc, 0x98df, MWA_RAM, &cclimber_bigspriteram },
  195.     { 0x9800, 0x9bff, MWA_RAM },  /* not used, but initialized */
  196.     { 0x9c00, 0x9fff, cclimber_colorram_w, &colorram },
  197.     { 0xa000, 0xa000, interrupt_enable_w },
  198.     { 0xa001, 0xa002, cclimber_flipscreen_w },
  199.     { 0xa004, 0xa004, cclimber_sample_trigger_w },
  200.     { 0xa800, 0xa800, cclimber_sample_rate_w },
  201.     { 0xb000, 0xb000, cclimber_sample_volume_w },
  202.     { -1 }  /* end of table */
  203. };
  204.  
  205. static struct IOReadPort readport[] =
  206. {
  207.     { 0x0c, 0x0c, AY8910_read_port_0_r },
  208.     { -1 }  /* end of table */
  209. };
  210.  
  211. static struct IOWritePort writeport[] =
  212. {
  213.     { 0x08, 0x08, AY8910_control_port_0_w },
  214.     { 0x09, 0x09, AY8910_write_port_0_w },
  215.     { -1 }  /* end of table */
  216. };
  217.  
  218.  
  219.  
  220. INPUT_PORTS_START( cclimber )
  221.     PORT_START      /* IN0 */
  222.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_UP     | IPF_8WAY )
  223.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_DOWN   | IPF_8WAY )
  224.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_LEFT   | IPF_8WAY )
  225.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_RIGHT  | IPF_8WAY )
  226.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_UP    | IPF_8WAY )
  227.     PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_DOWN  | IPF_8WAY )
  228.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_LEFT  | IPF_8WAY )
  229.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_RIGHT | IPF_8WAY )
  230.  
  231.     PORT_START      /* IN1 */
  232.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_UP     | IPF_8WAY | IPF_COCKTAIL )
  233.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_DOWN   | IPF_8WAY | IPF_COCKTAIL )
  234.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_LEFT   | IPF_8WAY | IPF_COCKTAIL )
  235.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICKLEFT_RIGHT  | IPF_8WAY | IPF_COCKTAIL )
  236.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_UP    | IPF_8WAY | IPF_COCKTAIL )
  237.     PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_DOWN  | IPF_8WAY | IPF_COCKTAIL )
  238.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_LEFT  | IPF_8WAY | IPF_COCKTAIL )
  239.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_RIGHT | IPF_8WAY | IPF_COCKTAIL )
  240.  
  241.     PORT_START      /* DSW */
  242.     PORT_DIPNAME( 0x03, 0x00, DEF_STR( Lives ) )
  243.     PORT_DIPSETTING(    0x00, "3" )
  244.     PORT_DIPSETTING(    0x01, "4" )
  245.     PORT_DIPSETTING(    0x02, "5" )
  246.     PORT_DIPSETTING(    0x03, "6" )
  247.     PORT_DIPNAME( 0x04, 0x00, DEF_STR( Bonus_Life ) )
  248.     PORT_DIPSETTING(    0x00, "30000" )
  249.     PORT_DIPSETTING(    0x04, "50000" )
  250.     PORT_BITX(    0x08, 0x00, IPT_DIPSWITCH_NAME | IPF_CHEAT, "Rack Test", KEYCODE_F1, IP_JOY_NONE )
  251.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  252.     PORT_DIPSETTING(    0x08, DEF_STR( On ) )
  253.     PORT_DIPNAME( 0x30, 0x00, DEF_STR( Coin_A ) )
  254.     PORT_DIPSETTING(    0x30, DEF_STR( 4C_1C ) )
  255.     PORT_DIPSETTING(    0x0020, DEF_STR( 3C_1C ) )
  256.     PORT_DIPSETTING(    0x10, DEF_STR( 2C_1C ) )
  257.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  258.     PORT_DIPNAME( 0xc0, 0x00, DEF_STR( Coin_B ) )
  259.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  260.     PORT_DIPSETTING(    0x40, DEF_STR( 1C_2C ) )
  261.     PORT_DIPSETTING(    0x80, DEF_STR( 1C_3C ) )
  262.     PORT_DIPSETTING(    0xc0, DEF_STR( Free_Play ) )
  263.  
  264.     PORT_START      /* IN2 */
  265.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
  266.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 )
  267.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START1 )
  268.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START2 )
  269.     PORT_DIPNAME( 0x10, 0x10, DEF_STR( Cabinet ) )
  270.     PORT_DIPSETTING(    0x10, DEF_STR( Upright ) )
  271.     PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
  272.     PORT_BIT( 0xe0, IP_ACTIVE_HIGH, IPT_UNUSED )
  273. INPUT_PORTS_END
  274.  
  275. /* several differences with cclimber: note that IN2 bits are ACTIVE_LOW, while in */
  276. /* cclimber they are ACTIVE_HIGH. */
  277. INPUT_PORTS_START( ckong )
  278.     PORT_START      /* IN0 */
  279.     PORT_BIT( 0x07, IP_ACTIVE_HIGH, IPT_UNUSED )
  280.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON1 )
  281.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP    | IPF_4WAY )
  282.     PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN  | IPF_4WAY )
  283.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT  | IPF_4WAY )
  284.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_4WAY )
  285.  
  286.     PORT_START      /* IN1 */
  287.     PORT_BIT( 0x07, IP_ACTIVE_HIGH, IPT_UNUSED )
  288.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_COCKTAIL )
  289.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP    | IPF_4WAY | IPF_COCKTAIL )
  290.     PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN  | IPF_4WAY | IPF_COCKTAIL )
  291.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT  | IPF_4WAY | IPF_COCKTAIL )
  292.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_4WAY | IPF_COCKTAIL )
  293.  
  294.     PORT_START      /* DSW */
  295.     PORT_DIPNAME( 0x03, 0x00, DEF_STR( Lives ) )
  296.     PORT_DIPSETTING(    0x00, "3" )
  297.     PORT_DIPSETTING(    0x01, "4" )
  298.     PORT_DIPSETTING(    0x02, "5" )
  299.     PORT_DIPSETTING(    0x03, "6" )
  300.     PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Bonus_Life ) )
  301.     PORT_DIPSETTING(    0x00, "7000" )
  302.     PORT_DIPSETTING(    0x04, "10000" )
  303.     PORT_DIPSETTING(    0x08, "15000" )
  304.     PORT_DIPSETTING(    0x0c, "20000" )
  305.     PORT_DIPNAME( 0x70, 0x00, DEF_STR( Coinage ) )
  306.     PORT_DIPSETTING(    0x70, DEF_STR( 5C_1C ) )
  307.     PORT_DIPSETTING(    0x50, DEF_STR( 4C_1C ) )
  308.     PORT_DIPSETTING(    0x30, DEF_STR( 3C_1C ) )
  309.     PORT_DIPSETTING(    0x10, DEF_STR( 2C_1C ) )
  310.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  311.     PORT_DIPSETTING(    0x0020, DEF_STR( 1C_2C ) )
  312.     PORT_DIPSETTING(    0x40, DEF_STR( 1C_3C ) )
  313.     PORT_DIPSETTING(    0x60, DEF_STR( 1C_4C ) )
  314.     PORT_DIPNAME( 0x80, 0x80, DEF_STR( Cabinet ) )
  315.     PORT_DIPSETTING(    0x80, DEF_STR( Upright ) )
  316.     PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
  317.  
  318.     PORT_START      /* IN2 */
  319.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
  320.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
  321.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 )
  322.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START2 )
  323.     PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
  324. INPUT_PORTS_END
  325.  
  326. INPUT_PORTS_START( rpatrolb )
  327.     PORT_START      /* IN0 */
  328.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_COCKTAIL )
  329.     PORT_BIT( 0x3e, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  330.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT  | IPF_2WAY | IPF_COCKTAIL )
  331.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_2WAY | IPF_COCKTAIL )
  332.  
  333.     PORT_START      /* IN1 */
  334.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 )
  335.     PORT_BIT( 0x3e, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  336.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT  | IPF_2WAY )
  337.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_2WAY )
  338.  
  339.     PORT_START      /* DSW */
  340.     PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coinage ) )
  341.     PORT_DIPSETTING(    0x02, DEF_STR( 2C_1C ) )
  342.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  343.     PORT_DIPSETTING(    0x01, DEF_STR( 1C_2C ) )
  344.     PORT_DIPSETTING(    0x03, DEF_STR( Free_Play ) )
  345.     PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Lives ) )
  346.     PORT_DIPSETTING(    0x00, "3" )
  347.     PORT_DIPSETTING(    0x04, "4" )
  348.     PORT_DIPSETTING(    0x08, "5" )
  349.     PORT_DIPSETTING(    0x0c, "6" )
  350.     PORT_DIPNAME( 0x10, 0x10, DEF_STR( Cabinet ) )
  351.     PORT_DIPSETTING(    0x10, DEF_STR( Upright ) )
  352.     PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
  353.     PORT_DIPNAME( 0x0020, 0x00, "Unknown 1" )  /* Probably unused */
  354.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  355.     PORT_DIPSETTING(    0x0020, DEF_STR( On ) )
  356.     PORT_DIPNAME( 0x40, 0x00, "Unknown 2" )  /* Probably unused */
  357.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  358.     PORT_DIPSETTING(    0x40, DEF_STR( On ) )
  359.     PORT_DIPNAME( 0x80, 0x80, "Memory Test" )
  360.     PORT_DIPSETTING(    0x00, "Retry on Error" )
  361.     PORT_DIPSETTING(    0x80, "Stop on Error" )
  362.  
  363.     PORT_START      /* IN0 */
  364.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
  365.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
  366.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START1 )
  367.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START2 )
  368.     PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
  369. INPUT_PORTS_END
  370.  
  371.  
  372.  
  373. static struct GfxLayout charlayout =
  374. {
  375.     8,8,    /* 8*8 characters */
  376.     512,    /* 512 characters (256 in Crazy Climber) */
  377.     2,      /* 2 bits per pixel */
  378.     { 0, 512*8*8 }, /* the two bitplanes are separated */
  379.     { 0, 1, 2, 3, 4, 5, 6, 7 },     /* pretty straightforward layout */
  380.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
  381.     8*8     /* every char takes 8 consecutive bytes */
  382. };
  383. static struct GfxLayout bscharlayout =
  384. {
  385.     8,8,    /* 8*8 characters */
  386.     256,    /* 256 characters */
  387.     2,      /* 2 bits per pixel */
  388.     { 0, 256*8*8 }, /* the bitplanes are separated */
  389.     { 0, 1, 2, 3, 4, 5, 6, 7 },     /* pretty straightforward layout */
  390.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
  391.     8*8     /* every char takes 8 consecutive bytes */
  392. };
  393. static struct GfxLayout spritelayout =
  394. {
  395.     16,16,  /* 16*16 sprites */
  396.     128,    /* 128 sprites (64 in Crazy Climber) */
  397.     2,      /* 2 bits per pixel */
  398.     { 0, 128*16*16 },       /* the bitplanes are separated */
  399.     { 0, 1, 2, 3, 4, 5, 6, 7,       /* pretty straightforward layout */
  400.             8*8+0, 8*8+1, 8*8+2, 8*8+3, 8*8+4, 8*8+5, 8*8+6, 8*8+7 },
  401.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
  402.             16*8, 17*8, 18*8, 19*8, 20*8, 21*8, 22*8, 23*8 },
  403.     32*8    /* every sprite takes 32 consecutive bytes */
  404. };
  405.  
  406. static struct GfxDecodeInfo gfxdecodeinfo[] =
  407. {
  408.     { REGION_GFX1, 0x0000, &charlayout,      0, 16 }, /* char set #1 */
  409.     { REGION_GFX1, 0x2000, &charlayout,      0, 16 }, /* char set #2 */
  410.     { REGION_GFX2, 0x0000, &bscharlayout, 16*4,  8 }, /* big sprite char set */
  411.     { REGION_GFX1, 0x0000, &spritelayout,    0, 16 }, /* sprite set #1 */
  412.     { REGION_GFX1, 0x2000, &spritelayout,    0, 16 }, /* sprite set #2 */
  413.     { -1 } /* end of array */
  414. };
  415.  
  416.  
  417.  
  418. static struct AY8910interface ay8910_interface =
  419. {
  420.     1,      /* 1 chip */
  421.     1536000,    /* 1.536 MHz */
  422.     { 50 },
  423.     { 0 },
  424.     { 0 },
  425.     { cclimber_sample_select_w },
  426.     { 0 }
  427. };
  428.  
  429. static struct CustomSound_interface custom_interface =
  430. {
  431.     cclimber_sh_start,
  432.     cclimber_sh_stop,
  433.     0
  434. };
  435.  
  436.  
  437.  
  438. static struct MachineDriver machine_driver_cclimber =
  439. {
  440.     /* basic machine hardware */
  441.     {
  442.         {
  443.             CPU_Z80,
  444.             3072000,    /* 3.072 MHz */
  445.             readmem,writemem,readport,writeport,
  446.             nmi_interrupt,1
  447.         }
  448.     },
  449.     60, DEFAULT_60HZ_VBLANK_DURATION,       /* frames per second, vblank duration */
  450.     1,      /* single CPU, no need for interleaving */
  451.     cclimber_init_machine,
  452.  
  453.     /* video hardware */
  454.     32*8, 32*8, { 0*8, 32*8-1, 2*8, 30*8-1 },
  455.     gfxdecodeinfo,
  456.     96,16*4+8*4,
  457.     cclimber_vh_convert_color_prom,
  458.  
  459.     VIDEO_TYPE_RASTER,
  460.     0,
  461.     cclimber_vh_start,
  462.     cclimber_vh_stop,
  463.     cclimber_vh_screenrefresh,
  464.  
  465.     /* sound hardware */
  466.     0,0,0,0,
  467.     {
  468.         {
  469.             SOUND_AY8910,
  470.             &ay8910_interface
  471.         },
  472.         {
  473.             SOUND_CUSTOM,
  474.             &custom_interface
  475.         }
  476.     }
  477. };
  478.  
  479.  
  480.  
  481. /***************************************************************************
  482.  
  483.   Game driver(s)
  484.  
  485. ***************************************************************************/
  486.  
  487. ROM_START( cclimber )
  488.     ROM_REGION( 2*0x10000, REGION_CPU1 )    /* 64k for code + 64k for decrypted opcodes */
  489.     ROM_LOAD( "cc11",         0x0000, 0x1000, 0x217ec4ff )
  490.     ROM_LOAD( "cc10",         0x1000, 0x1000, 0xb3c26cef )
  491.     ROM_LOAD( "cc09",         0x2000, 0x1000, 0x6db0879c )
  492.     ROM_LOAD( "cc08",         0x3000, 0x1000, 0xf48c5fe3 )
  493.     ROM_LOAD( "cc07",         0x4000, 0x1000, 0x3e873baf )
  494.  
  495.     ROM_REGION( 0x4000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  496.     ROM_LOAD( "cc06",         0x0000, 0x0800, 0x481b64cc )
  497.     /* empty hole - Crazy Kong has an additional ROM here */
  498.     ROM_LOAD( "cc04",         0x1000, 0x0800, 0x332347cb )
  499.     /* empty hole - Crazy Kong has an additional ROM here */
  500.     ROM_LOAD( "cc05",         0x2000, 0x0800, 0x2c33b760 )
  501.     /* empty hole - Crazy Kong has an additional ROM here */
  502.     ROM_LOAD( "cc03",         0x3000, 0x0800, 0x4e4b3658 )
  503.     /* empty hole - Crazy Kong has an additional ROM here */
  504.  
  505.     ROM_REGION( 0x1000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  506.     ROM_LOAD( "cc02",         0x0000, 0x0800, 0x14f3ecc9 )
  507.     ROM_LOAD( "cc01",         0x0800, 0x0800, 0x21c0f9fb )
  508.  
  509.     ROM_REGION( 0x0060, REGION_PROMS )
  510.     ROM_LOAD( "cclimber.pr1", 0x0000, 0x0020, 0x751c3325 )
  511.     ROM_LOAD( "cclimber.pr2", 0x0020, 0x0020, 0xab1940fa )
  512.     ROM_LOAD( "cclimber.pr3", 0x0040, 0x0020, 0x71317756 )
  513.  
  514.     ROM_REGION( 0x2000, REGION_SOUND1 )    /* samples */
  515.     ROM_LOAD( "cc13",         0x0000, 0x1000, 0xe0042f75 )
  516.     ROM_LOAD( "cc12",         0x1000, 0x1000, 0x5da13aaa )
  517. ROM_END
  518.  
  519. static void init_cclimber(void)
  520. {
  521. /*
  522.     translation mask is layed out like this:
  523.  
  524.       0 1 2 3 4 5 6 7 8 9 a b c d e f
  525.     0 <------A------> <------A------>
  526.     1 <------B------> <------B------>
  527.     2 <------A------> <------A------>
  528.     3 <------B------> <------B------>
  529.     4 <------C------> <------C------>
  530.     5 <------D------> <------D------>
  531.     6 <------C------> <------C------>
  532.     7 <------D------> <------D------>
  533.     8 <------E------> <------E------>
  534.     9 <------F------> <------F------>
  535.     a <------E------> <------E------>
  536.     b <------F------> <------F------>
  537.     c <------G------> <------G------>
  538.     d <------H------> <------H------>
  539.     e <------G------> <------G------>
  540.     f <------H------> <------H------>
  541.  
  542.     Where <------A------> etc. are groups of 8 unrelated values.
  543.  
  544.     therefore in the following table we only keep track of <--A-->, <--B--> etc.
  545. */
  546.     static const unsigned char xortable[2][64] =
  547.     {
  548.         /* -1 marks spots which are unused and therefore unknown */
  549.         {
  550.             0x44,0x15,0x45,0x11,0x50,0x15,0x15,0x41,
  551.             0x01,0x50,0x15,0x41,0x11,0x45,0x45,0x11,
  552.             0x11,0x41,0x01,0x55,0x04,0x10,0x51,0x05,
  553.             0x15,0x55,0x51,0x05,0x55,0x40,0x01,0x55,
  554.             0x54,0x50,0x51,0x05,0x11,0x40,0x14,  -1,
  555.             0x54,0x10,0x40,0x51,0x05,0x54,0x14,  -1,
  556.             0x44,0x14,0x01,0x40,0x14,  -1,0x41,0x50,
  557.             0x50,0x41,0x41,0x45,0x14,  -1,0x10,0x01
  558.         },
  559.         {
  560.             0x44,0x11,0x04,0x50,0x11,0x50,0x41,0x05,
  561.             0x10,0x50,0x54,0x01,0x54,0x44,  -1,0x40,
  562.             0x54,0x04,0x51,0x15,0x55,0x15,0x14,0x05,
  563.             0x51,0x05,0x55,  -1,0x50,0x50,0x40,0x54,
  564.               -1,0x55,  -1,  -1,0x10,0x55,0x50,0x04,
  565.             0x41,0x10,0x05,0x51,  -1,0x55,0x51,0x54,
  566.             0x01,0x51,0x11,0x45,0x44,0x10,0x14,0x40,
  567.             0x55,0x15,0x41,0x15,0x45,0x10,0x44,0x41
  568.         }
  569.     };
  570.     int A;
  571.     unsigned char *rom = memory_region(REGION_CPU1);
  572.     int diff = memory_region_length(REGION_CPU1) / 2;
  573.  
  574.  
  575.     memory_set_opcode_base(0,rom+diff);
  576.  
  577.     for (A = 0x0000;A < 0x10000;A++)
  578.     {
  579.         int i,j;
  580.         unsigned char src;
  581.  
  582.  
  583.         src = rom[A];
  584.  
  585.         /* pick the translation table from bit 0 of the address */
  586.         i = A & 1;
  587.  
  588.         /* pick the offset in the table from bits 012467 of the source data */
  589.         j = (src & 0x07) + ((src & 0x10) >> 1) + ((src & 0xc0) >> 2);
  590.  
  591.         /* decode the opcodes */
  592.         rom[A + diff] = src ^ xortable[i][j];
  593.     }
  594. }
  595.  
  596. ROM_START( cclimbrj )
  597.     ROM_REGION( 2*0x10000, REGION_CPU1 )    /* 64k for code + 64k for decrypted opcodes */
  598.     ROM_LOAD( "cc11j.bin",    0x0000, 0x1000, 0x89783959 )
  599.     ROM_LOAD( "cc10j.bin",    0x1000, 0x1000, 0x14eda506 )
  600.     ROM_LOAD( "cc09j.bin",    0x2000, 0x1000, 0x26489069 )
  601.     ROM_LOAD( "cc08j.bin",    0x3000, 0x1000, 0xb33c96f8 )
  602.     ROM_LOAD( "cc07j.bin",    0x4000, 0x1000, 0xfbc9626c )
  603.  
  604.     ROM_REGION( 0x4000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  605.     ROM_LOAD( "cc06",         0x0000, 0x0800, 0x481b64cc )
  606.     /* empty hole - Crazy Kong has an additional ROM here */
  607.     ROM_LOAD( "cc04",         0x1000, 0x0800, 0x332347cb )
  608.     /* empty hole - Crazy Kong has an additional ROM here */
  609.     ROM_LOAD( "cc05",         0x2000, 0x0800, 0x2c33b760 )
  610.     /* empty hole - Crazy Kong has an additional ROM here */
  611.     ROM_LOAD( "cc03",         0x3000, 0x0800, 0x4e4b3658 )
  612.     /* empty hole - Crazy Kong has an additional ROM here */
  613.  
  614.     ROM_REGION( 0x1000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  615.     ROM_LOAD( "cc02",         0x0000, 0x0800, 0x14f3ecc9 )
  616.     ROM_LOAD( "cc01",         0x0800, 0x0800, 0x21c0f9fb )
  617.  
  618.     ROM_REGION( 0x0060, REGION_PROMS )
  619.     ROM_LOAD( "cclimber.pr1", 0x0000, 0x0020, 0x751c3325 )
  620.     ROM_LOAD( "cclimber.pr2", 0x0020, 0x0020, 0xab1940fa )
  621.     ROM_LOAD( "cclimber.pr3", 0x0040, 0x0020, 0x71317756 )
  622.  
  623.     ROM_REGION( 0x2000, REGION_SOUND1 )    /* samples */
  624.     ROM_LOAD( "cc13j.bin",    0x0000, 0x1000, 0x5f0bcdfb )
  625.     ROM_LOAD( "cc12j.bin",    0x1000, 0x1000, 0x9003ffbd )
  626. ROM_END
  627.  
  628. ROM_START( ccboot )
  629.     ROM_REGION( 2*0x10000, REGION_CPU1 )    /* 64k for code + 64k for decrypted opcodes */
  630.     ROM_LOAD( "m11.bin",      0x0000, 0x1000, 0x5efbe180 )
  631.     ROM_LOAD( "m10.bin",      0x1000, 0x1000, 0xbe2748c7 )
  632.     ROM_LOAD( "cc09j.bin",    0x2000, 0x1000, 0x26489069 )
  633.     ROM_LOAD( "m08.bin",      0x3000, 0x1000, 0xe3c542d6 )
  634.     ROM_LOAD( "cc07j.bin",    0x4000, 0x1000, 0xfbc9626c )
  635.  
  636.     ROM_REGION( 0x4000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  637.     ROM_LOAD( "cc06",         0x0000, 0x0800, 0x481b64cc )
  638.     /* empty hole - Crazy Kong has an additional ROM here */
  639.     ROM_LOAD( "m04.bin",      0x1000, 0x0800, 0x6fb80538 )
  640.     /* empty hole - Crazy Kong has an additional ROM here */
  641.     ROM_LOAD( "m05.bin",      0x2000, 0x0800, 0x056af36b )
  642.     /* empty hole - Crazy Kong has an additional ROM here */
  643.     ROM_LOAD( "m03.bin",      0x3000, 0x0800, 0x67127253 )
  644.     /* empty hole - Crazy Kong has an additional ROM here */
  645.  
  646.     ROM_REGION( 0x1000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  647.     ROM_LOAD( "m02.bin",      0x0000, 0x0800, 0x7f4877de )
  648.     ROM_LOAD( "m01.bin",      0x0800, 0x0800, 0x49fab908 )
  649.  
  650.     ROM_REGION( 0x0060, REGION_PROMS )
  651.     ROM_LOAD( "cclimber.pr1", 0x0000, 0x0020, 0x751c3325 )
  652.     ROM_LOAD( "cclimber.pr2", 0x0020, 0x0020, 0xab1940fa )
  653.     ROM_LOAD( "cclimber.pr3", 0x0040, 0x0020, 0x71317756 )
  654.  
  655.     ROM_REGION( 0x2000, REGION_SOUND1 )    /* samples */
  656.     ROM_LOAD( "cc13j.bin",    0x0000, 0x1000, 0x5f0bcdfb )
  657.     ROM_LOAD( "cc12j.bin",    0x1000, 0x1000, 0x9003ffbd )
  658. ROM_END
  659.  
  660. ROM_START( ccboot2 )
  661.     ROM_REGION( 2*0x10000, REGION_CPU1 )    /* 64k for code + 64k for decrypted opcodes */
  662.     ROM_LOAD( "11.4k",        0x0000, 0x1000, 0xb2b17e24 )
  663.     ROM_LOAD( "10.4j",        0x1000, 0x1000, 0x8382bc0f )
  664.     ROM_LOAD( "cc09j.bin",    0x2000, 0x1000, 0x26489069 )
  665.     ROM_LOAD( "m08.bin",      0x3000, 0x1000, 0xe3c542d6 )
  666.     ROM_LOAD( "cc07j.bin",    0x4000, 0x1000, 0xfbc9626c )
  667.  
  668.     ROM_REGION( 0x4000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  669.     ROM_LOAD( "cc06",         0x0000, 0x0800, 0x481b64cc )
  670.     /* empty hole - Crazy Kong has an additional ROM here */
  671.     ROM_LOAD( "cc04",         0x1000, 0x0800, 0x332347cb )
  672.     /* empty hole - Crazy Kong has an additional ROM here */
  673.     ROM_LOAD( "cc05",         0x2000, 0x0800, 0x2c33b760 )
  674.     /* empty hole - Crazy Kong has an additional ROM here */
  675.     ROM_LOAD( "cc03",         0x3000, 0x0800, 0x4e4b3658 )
  676.     /* empty hole - Crazy Kong has an additional ROM here */
  677.  
  678.     ROM_REGION( 0x1000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  679.     ROM_LOAD( "cc02",         0x0000, 0x0800, 0x14f3ecc9 )
  680.     ROM_LOAD( "cc01",         0x0800, 0x0800, 0x21c0f9fb )
  681.  
  682.     ROM_REGION( 0x0060, REGION_PROMS )
  683.     ROM_LOAD( "cclimber.pr1", 0x0000, 0x0020, 0x751c3325 )
  684.     ROM_LOAD( "cclimber.pr2", 0x0020, 0x0020, 0xab1940fa )
  685.     ROM_LOAD( "cclimber.pr3", 0x0040, 0x0020, 0x71317756 )
  686.  
  687.     ROM_REGION( 0x2000, REGION_SOUND1 )    /* samples */
  688.     ROM_LOAD( "cc13j.bin",    0x0000, 0x1000, 0x5f0bcdfb )
  689.     ROM_LOAD( "cc12j.bin",    0x1000, 0x1000, 0x9003ffbd )
  690. ROM_END
  691.  
  692. static void init_cclimbrj(void)
  693. {
  694. /*
  695.     translation mask is layed out like this:
  696.  
  697.       0 1 2 3 4 5 6 7 8 9 a b c d e f
  698.     0 <------A------> <------A------>
  699.     1 <------B------> <------B------>
  700.     2 <------A------> <------A------>
  701.     3 <------B------> <------B------>
  702.     4 <------C------> <------C------>
  703.     5 <------D------> <------D------>
  704.     6 <------C------> <------C------>
  705.     7 <------D------> <------D------>
  706.     8 <------E------> <------E------>
  707.     9 <------F------> <------F------>
  708.     a <------E------> <------E------>
  709.     b <------F------> <------F------>
  710.     c <------G------> <------G------>
  711.     d <------H------> <------H------>
  712.     e <------G------> <------G------>
  713.     f <------H------> <------H------>
  714.  
  715.     Where <------A------> etc. are groups of 8 unrelated values.
  716.  
  717.     therefore in the following table we only keep track of <--A-->, <--B--> etc.
  718. */
  719.     static const unsigned char xortable[2][64] =
  720.     {
  721.         {
  722.             0x41,0x55,0x44,0x10,0x55,0x11,0x04,0x55,
  723.             0x15,0x01,0x51,0x45,0x15,0x40,0x10,0x01,
  724.             0x04,0x50,0x55,0x01,0x44,0x15,0x15,0x10,
  725.             0x45,0x11,0x55,0x41,0x50,0x10,0x55,0x10,
  726.             0x14,0x40,0x05,0x54,0x05,0x41,0x04,0x55,
  727.             0x14,0x41,0x01,0x51,0x45,0x50,0x40,0x01,
  728.             0x51,0x01,0x05,0x10,0x10,0x50,0x54,0x41,
  729.             0x40,0x51,0x14,0x50,0x01,0x50,0x15,0x40
  730.         },
  731.         {
  732.             0x50,0x10,0x10,0x51,0x44,0x50,0x50,0x50,
  733.             0x41,0x05,0x11,0x55,0x51,0x11,0x54,0x11,
  734.             0x14,0x54,0x54,0x50,0x54,0x40,0x44,0x04,
  735.             0x14,0x50,0x15,0x44,0x54,0x14,0x05,0x50,
  736.             0x01,0x04,0x55,0x51,0x45,0x40,0x11,0x15,
  737.             0x44,0x41,0x11,0x15,0x41,0x05,0x55,0x51,
  738.             0x51,0x54,0x05,0x01,0x15,0x51,0x41,0x45,
  739.             0x14,0x11,0x41,0x45,0x50,0x55,0x05,0x01
  740.         }
  741.     };
  742.     int A;
  743.     unsigned char *rom = memory_region(REGION_CPU1);
  744.     int diff = memory_region_length(REGION_CPU1) / 2;
  745.  
  746.  
  747.     memory_set_opcode_base(0,rom+diff);
  748.  
  749.     for (A = 0x0000;A < 0x10000;A++)
  750.     {
  751.         int i,j;
  752.         unsigned char src;
  753.  
  754.  
  755.         src = rom[A];
  756.  
  757.         /* pick the translation table from bit 0 of the address */
  758.         i = A & 1;
  759.  
  760.         /* pick the offset in the table from bits 012467 of the source data */
  761.         j = (src & 0x07) + ((src & 0x10) >> 1) + ((src & 0xc0) >> 2);
  762.  
  763.         /* decode the opcodes */
  764.         rom[A + diff] = src ^ xortable[i][j];
  765.     }
  766. }
  767.  
  768. ROM_START( ckong )
  769.     ROM_REGION( 0x10000, REGION_CPU1 )     /* 64k for code */
  770.     ROM_LOAD( "d05-07.bin",   0x0000, 0x1000, 0xb27df032 )
  771.     ROM_LOAD( "f05-08.bin",   0x1000, 0x1000, 0x5dc1aaba )
  772.     ROM_LOAD( "h05-09.bin",   0x2000, 0x1000, 0xc9054c94 )
  773.     ROM_LOAD( "k05-10.bin",   0x3000, 0x1000, 0x069c4797 )
  774.     ROM_LOAD( "l05-11.bin",   0x4000, 0x1000, 0xae159192 )
  775.     ROM_LOAD( "n05-12.bin",   0x5000, 0x1000, 0x966bc9ab )
  776.  
  777.     ROM_REGION( 0x4000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  778.     ROM_LOAD( "n11-06.bin",   0x0000, 0x1000, 0x2dcedd12 )
  779.     ROM_LOAD( "k11-04.bin",   0x1000, 0x1000, 0x3375b3bd )
  780.     ROM_LOAD( "l11-05.bin",   0x2000, 0x1000, 0xfa7cbd91 )
  781.     ROM_LOAD( "h11-03.bin",   0x3000, 0x1000, 0x5655cc11 )
  782.  
  783.     ROM_REGION( 0x1000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  784.     ROM_LOAD( "c11-02.bin",   0x0000, 0x0800, 0xd1352c31 )
  785.     ROM_LOAD( "a11-01.bin",   0x0800, 0x0800, 0xa7a2fdbd )
  786.  
  787.     ROM_REGION( 0x0060, REGION_PROMS )
  788.     ROM_LOAD( "prom.v6",      0x0000, 0x0020, 0xb3fc1505 )
  789.     ROM_LOAD( "prom.u6",      0x0020, 0x0020, 0x26aada9e )
  790.     ROM_LOAD( "prom.t6",      0x0040, 0x0020, 0x676b3166 )
  791.  
  792.     ROM_REGION( 0x2000, REGION_SOUND1 )    /* samples */
  793.     ROM_LOAD( "cc13j.bin",    0x0000, 0x1000, 0x5f0bcdfb )
  794.     ROM_LOAD( "cc12j.bin",    0x1000, 0x1000, 0x9003ffbd )
  795. ROM_END
  796.  
  797. ROM_START( ckonga )
  798.     ROM_REGION( 0x10000, REGION_CPU1 )     /* 64k for code */
  799.     ROM_LOAD( "d05-07.bin",   0x0000, 0x1000, 0xb27df032 )
  800.     ROM_LOAD( "f05-08.bin",   0x1000, 0x1000, 0x5dc1aaba )
  801.     ROM_LOAD( "h05-09.bin",   0x2000, 0x1000, 0xc9054c94 )
  802.     ROM_LOAD( "10.dat",       0x3000, 0x1000, 0xc3beb501 )
  803.     ROM_LOAD( "l05-11.bin",   0x4000, 0x1000, 0xae159192 )
  804.     ROM_LOAD( "n05-12.bin",   0x5000, 0x1000, 0x966bc9ab )
  805.  
  806.     ROM_REGION( 0x4000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  807.     ROM_LOAD( "n11-06.bin",   0x0000, 0x1000, 0x2dcedd12 )
  808.     ROM_LOAD( "k11-04.bin",   0x1000, 0x1000, 0x3375b3bd )
  809.     ROM_LOAD( "l11-05.bin",   0x2000, 0x1000, 0xfa7cbd91 )
  810.     ROM_LOAD( "h11-03.bin",   0x3000, 0x1000, 0x5655cc11 )
  811.  
  812.     ROM_REGION( 0x1000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  813.     ROM_LOAD( "c11-02.bin",   0x0000, 0x0800, 0xd1352c31 )
  814.     ROM_LOAD( "a11-01.bin",   0x0800, 0x0800, 0xa7a2fdbd )
  815.  
  816.     ROM_REGION( 0x0060, REGION_PROMS )
  817.     ROM_LOAD( "prom.v6",      0x0000, 0x0020, 0xb3fc1505 )
  818.     ROM_LOAD( "prom.u6",      0x0020, 0x0020, 0x26aada9e )
  819.     ROM_LOAD( "prom.t6",      0x0040, 0x0020, 0x676b3166 )
  820.  
  821.     ROM_REGION( 0x2000, REGION_SOUND1 )    /* samples */
  822.     ROM_LOAD( "cc13j.bin",    0x0000, 0x1000, 0x5f0bcdfb )
  823.     ROM_LOAD( "cc12j.bin",    0x1000, 0x1000, 0x9003ffbd )
  824. ROM_END
  825.  
  826. ROM_START( ckongjeu )
  827.     ROM_REGION( 0x10000, REGION_CPU1 )     /* 64k for code */
  828.     ROM_LOAD( "d05-07.bin",   0x0000, 0x1000, 0xb27df032 )
  829.     ROM_LOAD( "f05-08.bin",   0x1000, 0x1000, 0x5dc1aaba )
  830.     ROM_LOAD( "h05-09.bin",   0x2000, 0x1000, 0xc9054c94 )
  831.     ROM_LOAD( "ckjeu10.dat",  0x3000, 0x1000, 0x7e6eeec4 )
  832.     ROM_LOAD( "l05-11.bin",   0x4000, 0x1000, 0xae159192 )
  833.     ROM_LOAD( "ckjeu12.dat",  0x5000, 0x1000, 0x0532f270 )
  834.  
  835.     ROM_REGION( 0x4000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  836.     ROM_LOAD( "n11-06.bin",   0x0000, 0x1000, 0x2dcedd12 )
  837.     ROM_LOAD( "k11-04.bin",   0x1000, 0x1000, 0x3375b3bd )
  838.     ROM_LOAD( "l11-05.bin",   0x2000, 0x1000, 0xfa7cbd91 )
  839.     ROM_LOAD( "h11-03.bin",   0x3000, 0x1000, 0x5655cc11 )
  840.  
  841.     ROM_REGION( 0x1000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  842.     ROM_LOAD( "c11-02.bin",   0x0000, 0x0800, 0xd1352c31 )
  843.     ROM_LOAD( "a11-01.bin",   0x0800, 0x0800, 0xa7a2fdbd )
  844.  
  845.     ROM_REGION( 0x0060, REGION_PROMS )
  846.     ROM_LOAD( "prom.v6",      0x0000, 0x0020, 0xb3fc1505 )
  847.     ROM_LOAD( "prom.u6",      0x0020, 0x0020, 0x26aada9e )
  848.     ROM_LOAD( "prom.t6",      0x0040, 0x0020, 0x676b3166 )
  849.  
  850.     ROM_REGION( 0x2000, REGION_SOUND1 )    /* samples */
  851.     ROM_LOAD( "cc13j.bin",    0x0000, 0x1000, 0x5f0bcdfb )
  852.     ROM_LOAD( "cc12j.bin",    0x1000, 0x1000, 0x9003ffbd )
  853. ROM_END
  854.  
  855. ROM_START( ckongo )
  856.     ROM_REGION( 0x10000, REGION_CPU1 )     /* 64k for code */
  857.     ROM_LOAD( "o55a-1",       0x0000, 0x1000, 0x8bfb4623 )
  858.     ROM_LOAD( "o55a-2",       0x1000, 0x1000, 0x9ae8089b )
  859.     ROM_LOAD( "o55a-3",       0x2000, 0x1000, 0xe82b33c8 )
  860.     ROM_LOAD( "o55a-4",       0x3000, 0x1000, 0xf038f941 )
  861.     ROM_LOAD( "o55a-5",       0x4000, 0x1000, 0x5182db06 )
  862.     /* no ROM at 5000 */
  863.  
  864.     ROM_REGION( 0x4000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  865.     /* same as ckong but with halves switched */
  866.     ROM_LOAD( "o50b-1",       0x0000, 0x0800, 0xcae9e2bf )
  867.     ROM_CONTINUE(             0x2000, 0x0800 )
  868.     ROM_LOAD( "o50b-2",       0x0800, 0x0800, 0xfba82114 )
  869.     ROM_CONTINUE(             0x2800, 0x0800 )
  870.     ROM_LOAD( "o50b-3",       0x1000, 0x0800, 0x1714764b )
  871.     ROM_CONTINUE(             0x3000, 0x0800 )
  872.     ROM_LOAD( "o50b-4",       0x1800, 0x0800, 0xb7008b57 )
  873.     ROM_CONTINUE(             0x3800, 0x0800 )
  874.  
  875.     ROM_REGION( 0x1000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  876.     ROM_LOAD( "c11-02.bin",   0x0000, 0x0800, 0xd1352c31 )
  877.     ROM_LOAD( "a11-01.bin",   0x0800, 0x0800, 0xa7a2fdbd )
  878.  
  879.     ROM_REGION( 0x0060, REGION_PROMS )
  880.     ROM_LOAD( "prom.v6",      0x0000, 0x0020, 0xb3fc1505 )
  881.     ROM_LOAD( "prom.u6",      0x0020, 0x0020, 0x26aada9e )
  882.     ROM_LOAD( "prom.t6",      0x0040, 0x0020, 0x676b3166 )
  883.  
  884.     ROM_REGION( 0x2000, REGION_SOUND1 )    /* samples */
  885.     ROM_LOAD( "cc13j.bin",    0x0000, 0x1000, 0x5f0bcdfb )
  886.     ROM_LOAD( "cc12j.bin",    0x1000, 0x1000, 0x9003ffbd )
  887. ROM_END
  888.  
  889. ROM_START( ckongalc )
  890.     ROM_REGION( 0x10000, REGION_CPU1 )     /* 64k for code */
  891.     ROM_LOAD( "ck7.bin",      0x0000, 0x1000, 0x2171cac3 )
  892.     ROM_LOAD( "ck8.bin",      0x1000, 0x1000, 0x88b83ff7 )
  893.     ROM_LOAD( "ck9.bin",      0x2000, 0x1000, 0xcff2af47 )
  894.     ROM_LOAD( "ck10.bin",     0x3000, 0x1000, 0x520fa4de )
  895.     ROM_LOAD( "ck11.bin",     0x4000, 0x1000, 0x327dcadf )
  896.     /* no ROM at 5000 */
  897.  
  898.     ROM_REGION( 0x4000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  899.     ROM_LOAD( "ck6.bin",      0x0000, 0x1000, 0xa8916dc8 )
  900.     ROM_LOAD( "ck4.bin",      0x1000, 0x1000, 0xb62a0367 )
  901.     ROM_LOAD( "ck5.bin",      0x2000, 0x1000, 0xcd3b5dde )
  902.     ROM_LOAD( "ck3.bin",      0x3000, 0x1000, 0x61122c5e )
  903.  
  904.     ROM_REGION( 0x1000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  905.     ROM_LOAD( "ck2.bin",      0x0000, 0x0800, 0xf67c80f1 )
  906.     ROM_LOAD( "ck1.bin",      0x0800, 0x0800, 0x80eb517d )
  907.  
  908.     ROM_REGION( 0x0060, REGION_PROMS )
  909.     ROM_LOAD( "cclimber.pr1", 0x0000, 0x0020, 0x751c3325 )
  910.     ROM_LOAD( "cclimber.pr2", 0x0020, 0x0020, 0xab1940fa )
  911.     ROM_LOAD( "ck6t.bin",     0x0040, 0x0020, 0xb4e827a5 )
  912.  
  913.     ROM_REGION( 0x2000, REGION_SOUND1 )    /* samples */
  914.     ROM_LOAD( "cc13j.bin",    0x0000, 0x1000, 0x5f0bcdfb )
  915.     ROM_LOAD( "ck12.bin",     0x1000, 0x1000, 0x2eb23b60 )
  916. ROM_END
  917.  
  918. ROM_START( monkeyd )
  919.     ROM_REGION( 0x10000, REGION_CPU1 )     /* 64k for code */
  920.     ROM_LOAD( "ck7.bin",      0x0000, 0x1000, 0x2171cac3 )
  921.     ROM_LOAD( "ck8.bin",      0x1000, 0x1000, 0x88b83ff7 )
  922.     ROM_LOAD( "ck9.bin",      0x2000, 0x1000, 0xcff2af47 )
  923.     ROM_LOAD( "ck10.bin",     0x3000, 0x1000, 0x520fa4de )
  924.     ROM_LOAD( "md5l.bin",     0x4000, 0x1000, 0xd1db1bb0 )
  925.     /* no ROM at 5000 */
  926.  
  927.     ROM_REGION( 0x4000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  928.     ROM_LOAD( "ck6.bin",      0x0000, 0x1000, 0xa8916dc8 )
  929.     ROM_LOAD( "ck4.bin",      0x1000, 0x1000, 0xb62a0367 )
  930.     ROM_LOAD( "ck5.bin",      0x2000, 0x1000, 0xcd3b5dde )
  931.     ROM_LOAD( "ck3.bin",      0x3000, 0x1000, 0x61122c5e )
  932.  
  933.     ROM_REGION( 0x1000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  934.     ROM_LOAD( "ck2.bin",      0x0000, 0x0800, 0xf67c80f1 )
  935.     ROM_LOAD( "ck1.bin",      0x0800, 0x0800, 0x80eb517d )
  936.  
  937.     ROM_REGION( 0x0060, REGION_PROMS )
  938.     ROM_LOAD( "cclimber.pr1", 0x0000, 0x0020, 0x00000000 )
  939.     ROM_LOAD( "cclimber.pr2", 0x0020, 0x0020, 0x00000000 )
  940.     ROM_LOAD( "ck6t.bin",     0x0040, 0x0020, 0x00000000 )
  941.  
  942.     ROM_REGION( 0x2000, REGION_SOUND1 )    /* samples */
  943.     ROM_LOAD( "cc13j.bin",    0x0000, 0x1000, 0x5f0bcdfb )
  944.     ROM_LOAD( "ck12.bin",     0x1000, 0x1000, 0x2eb23b60 )
  945. ROM_END
  946.  
  947. ROM_START( rpatrolb )
  948.     ROM_REGION( 0x10000, REGION_CPU1 )     /* 64k for code */
  949.     ROM_LOAD( "rp1.4l",       0x0000, 0x1000, 0xbfd7ae7a )
  950.     ROM_LOAD( "rp2.4j",       0x1000, 0x1000, 0x03f53340 )
  951.     ROM_LOAD( "rp3.4f",       0x2000, 0x1000, 0x8fa300df )
  952.     ROM_LOAD( "rp4.4e",       0x3000, 0x1000, 0x74a8f1f4 )
  953.     ROM_LOAD( "rp5.4c",       0x4000, 0x1000, 0xd7ef6c87 )
  954.     /* no ROM at 5000 */
  955.  
  956.     ROM_REGION( 0x4000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  957.     ROM_LOAD( "rp6.6n",       0x0000, 0x0800, 0x19f18e9e )
  958.     /* 0800-0fff empty */
  959.     ROM_LOAD( "rp8.6k",       0x1000, 0x0800, 0x008738c7 )
  960.     /* 1800-1fff empty */
  961.     ROM_LOAD( "rp7.6l",       0x2000, 0x0800, 0x07f2070d )
  962.     /* 2800-2fff empty */
  963.     ROM_LOAD( "rp9.6h",       0x3000, 0x0800, 0xea5aafca )
  964.     /* 3800-3fff empty */
  965.  
  966.     ROM_REGION( 0x1000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  967.     ROM_LOAD( "rp11.6c",      0x0000, 0x0800, 0x065651a5 )
  968.     ROM_LOAD( "rp10.6a",      0x0800, 0x0800, 0x59747c31 )
  969.  
  970.     ROM_REGION( 0x0060, REGION_PROMS )
  971.     ROM_LOAD( "bprom1.9n",    0x0000, 0x0020, 0xf9a2383b )
  972.     ROM_LOAD( "bprom2.9p",    0x0020, 0x0020, 0x1743bd26 )
  973.     ROM_LOAD( "bprom3.9c",    0x0040, 0x0020, 0xee03bc96 )
  974.  
  975.     /* no samples */
  976. ROM_END
  977.  
  978. ROM_START( silvland )
  979.     ROM_REGION( 0x10000, REGION_CPU1 )     /* 64k for code */
  980.     ROM_LOAD( "7.2r",         0x0000, 0x1000, 0x57e6be62 )
  981.     ROM_LOAD( "8.1n",         0x1000, 0x1000, 0xbbb2b287 )
  982.     ROM_LOAD( "rp3.4f",       0x2000, 0x1000, 0x8fa300df )
  983.     ROM_LOAD( "10.2n",        0x3000, 0x1000, 0x5536a65d )
  984.     ROM_LOAD( "11.1r",        0x4000, 0x1000, 0x6f23f66f )
  985.     ROM_LOAD( "12.2k",        0x5000, 0x1000, 0x26f1537c )
  986.  
  987.     ROM_REGION( 0x4000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  988.     ROM_LOAD( "6.6n",         0x0000, 0x0800, 0xaffb804f )
  989.     /* 0800-0fff empty */
  990.     ROM_LOAD( "4.6k",         0x1000, 0x0800, 0xe487579d )
  991.     /* 1800-1fff empty */
  992.     ROM_LOAD( "5.6l",         0x2000, 0x0800, 0xad4642e5 )
  993.     /* 2800-2fff empty */
  994.     ROM_LOAD( "3.6h",         0x3000, 0x0800, 0x59125a1a )
  995.     /* 3800-3fff empty */
  996.  
  997.     ROM_REGION( 0x1000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  998.     ROM_LOAD( "2.6c",         0x0000, 0x0800, 0xc8d32b8e )
  999.     ROM_LOAD( "1.6a",         0x0800, 0x0800, 0xee333daf )
  1000.  
  1001.     ROM_REGION( 0x0060, REGION_PROMS )
  1002.     ROM_LOAD( "mb7051.1v",    0x0000, 0x0020, 0x1d2343b1 )
  1003.     ROM_LOAD( "mb7051.1u",    0x0020, 0x0020, 0xc174753c )
  1004.     ROM_LOAD( "mb7051.1t",    0x0040, 0x0020, 0x04a1be01 )
  1005.  
  1006.     /* no samples */
  1007. ROM_END
  1008.  
  1009.  
  1010.  
  1011.  
  1012.  
  1013. /***************************************************************************
  1014.  
  1015.   Swimmer driver
  1016.  
  1017. ***************************************************************************/
  1018.  
  1019. WRITE_HANDLER( swimmer_bgcolor_w );
  1020. WRITE_HANDLER( swimmer_palettebank_w );
  1021. void swimmer_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
  1022. void swimmer_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  1023. WRITE_HANDLER( swimmer_sidepanel_enable_w );
  1024.  
  1025.  
  1026.  
  1027. WRITE_HANDLER( swimmer_sh_soundlatch_w )
  1028. {
  1029.     soundlatch_w(offset,data);
  1030.     cpu_cause_interrupt(1,0xff);
  1031. }
  1032.  
  1033.  
  1034.  
  1035. static struct MemoryReadAddress swimmer_readmem[] =
  1036. {
  1037.     { 0x0000, 0x7fff, MRA_ROM },
  1038.     { 0x8000, 0x87ff, MRA_RAM },
  1039.     { 0x9000, 0x93ff, MRA_RAM },
  1040.     { 0x9400, 0x97ff, videoram_r }, /* mirror address (used by Swimmer) */
  1041.     { 0x9c00, 0x9fff, MRA_RAM },
  1042.     { 0xa000, 0xa000, input_port_0_r },
  1043.     { 0xa800, 0xa800, input_port_1_r },
  1044.     { 0xb000, 0xb000, input_port_2_r },
  1045.     { 0xb800, 0xb800, input_port_3_r },
  1046.     { 0xb880, 0xb880, input_port_4_r },
  1047.     { 0xc000, 0xc7ff, MRA_RAM },    /* ??? used by Guzzler */
  1048.     { 0xe000, 0xffff, MRA_ROM },    /* Guzzler only */
  1049.     { -1 }  /* end of table */
  1050. };
  1051.  
  1052. static struct MemoryWriteAddress swimmer_writemem[] =
  1053. {
  1054.     { 0x0000, 0x7fff, MWA_ROM },
  1055.     { 0x8000, 0x87ff, MWA_RAM },
  1056.     { 0x8800, 0x88ff, cclimber_bigsprite_videoram_w, &cclimber_bsvideoram, &cclimber_bsvideoram_size },
  1057.     { 0x8900, 0x89ff, cclimber_bigsprite_videoram_w },      /* mirror for the above (Guzzler writes to both) */
  1058.     { 0x9000, 0x93ff, videoram_w, &videoram, &videoram_size },
  1059.     { 0x9400, 0x97ff, videoram_w }, /* mirror address (used by Guzzler) */
  1060.     { 0x9800, 0x981f, MWA_RAM, &cclimber_column_scroll },
  1061.     { 0x9880, 0x989f, MWA_RAM, &spriteram, &spriteram_size },
  1062.     { 0x98fc, 0x98ff, MWA_RAM, &cclimber_bigspriteram },
  1063.     { 0x9c00, 0x9fff, cclimber_colorram_w, &colorram },
  1064.     { 0xa000, 0xa000, interrupt_enable_w },
  1065.     { 0xa001, 0xa002, cclimber_flipscreen_w },
  1066.     { 0xa003, 0xa003, swimmer_sidepanel_enable_w },
  1067.     { 0xa004, 0xa004, swimmer_palettebank_w },
  1068.     { 0xa800, 0xa800, swimmer_sh_soundlatch_w },
  1069.     { 0xb800, 0xb800, swimmer_bgcolor_w },  /* river color in Swimmer */
  1070.     { 0xc000, 0xc7ff, MWA_RAM },    /* ??? used by Guzzler */
  1071.     { 0xe000, 0xffff, MWA_ROM },    /* Guzzler only */
  1072.     { -1 }  /* end of table */
  1073. };
  1074.  
  1075.  
  1076. static struct MemoryReadAddress sound_readmem[] =
  1077. {
  1078.     { 0x0000, 0x0fff, MRA_ROM },
  1079.     { 0x2000, 0x23ff, MRA_RAM },
  1080.     { 0x3000, 0x3000, soundlatch_r },
  1081.     { 0x4000, 0x4001, MRA_RAM },    /* ??? */
  1082.     { -1 }  /* end of table */
  1083. };
  1084.  
  1085. static struct MemoryWriteAddress sound_writemem[] =
  1086. {
  1087.     { 0x0000, 0x0fff, MWA_ROM },
  1088.     { 0x2000, 0x23ff, MWA_RAM },
  1089.     { 0x4000, 0x4000, MWA_RAM },    /* ??? */
  1090.     { -1 }  /* end of table */
  1091. };
  1092.  
  1093. static struct IOWritePort sound_writeport[] =
  1094. {
  1095.     { 0x00, 0x00, AY8910_write_port_0_w },
  1096.     { 0x01, 0x01, AY8910_control_port_0_w },
  1097.     { 0x80, 0x80, AY8910_write_port_1_w },
  1098.     { 0x81, 0x81, AY8910_control_port_1_w },
  1099.     { -1 }  /* end of table */
  1100. };
  1101.  
  1102.  
  1103.  
  1104. INPUT_PORTS_START( swimmer )
  1105.     PORT_START      /* IN0 */
  1106.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
  1107.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_COCKTAIL )
  1108.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_COCKTAIL )
  1109.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_COCKTAIL )
  1110.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_COCKTAIL )
  1111.     PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_UNKNOWN )   /* probably unused */
  1112.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )   /* probably unused */
  1113.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )   /* probably unused */
  1114.  
  1115.     PORT_START      /* IN1 */
  1116.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  1117.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT  | IPF_8WAY )
  1118.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP    | IPF_8WAY )
  1119.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN  | IPF_8WAY )
  1120.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 )
  1121.     PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_UNKNOWN )   /* probably unused */
  1122.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )   /* probably unused */
  1123.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )   /* probably unused */
  1124.  
  1125.     PORT_START      /* DSW1 */
  1126.     PORT_DIPNAME( 0x03, 0x00, DEF_STR( Lives ) )
  1127.     PORT_DIPSETTING(    0x00, "3" )
  1128.     PORT_DIPSETTING(    0x01, "4" )
  1129.     PORT_DIPSETTING(    0x02, "5" )
  1130.     PORT_BITX( 0,       0x03, IPT_DIPSWITCH_SETTING | IPF_CHEAT, "Infinite", IP_KEY_NONE, IP_JOY_NONE )
  1131.     PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Bonus_Life ) )
  1132.     PORT_DIPSETTING(    0x00, "10000" )
  1133.     PORT_DIPSETTING(    0x04, "20000" )
  1134.     PORT_DIPSETTING(    0x08, "30000" )
  1135.     PORT_DIPSETTING(    0x0c, "None" )
  1136.     PORT_DIPNAME( 0x30, 0x00, DEF_STR( Coin_A ) )
  1137.     PORT_DIPSETTING(    0x10, DEF_STR( 2C_1C ) )
  1138.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  1139.     PORT_DIPSETTING(    0x0020, DEF_STR( 1C_2C ) )
  1140.     PORT_DIPSETTING(    0x30, DEF_STR( 1C_3C ) )
  1141.     PORT_DIPNAME( 0xc0, 0x00, DEF_STR( Coin_B ) )
  1142.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  1143.     PORT_DIPSETTING(    0x40, DEF_STR( 1C_2C ) )
  1144.     PORT_DIPSETTING(    0x80, DEF_STR( 1C_3C ) )
  1145.     PORT_DIPSETTING(    0xc0, DEF_STR( 1C_6C ) )
  1146.  
  1147.     PORT_START      /* IN3/DSW2 */
  1148.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  1149.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  1150.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START1 )
  1151.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START2 )
  1152.     PORT_DIPNAME( 0x10, 0x10, DEF_STR( Cabinet ) )
  1153.     PORT_DIPSETTING(    0x10, DEF_STR( Upright ) )
  1154.     PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
  1155.     PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Demo_Sounds ) )
  1156.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  1157.     PORT_DIPSETTING(    0x0020, DEF_STR( On ) )
  1158.     PORT_DIPNAME( 0xc0, 0x80, DEF_STR( Difficulty ) )
  1159.     PORT_DIPSETTING(    0x00, "Easy" )
  1160.     PORT_DIPSETTING(    0x40, "???" )
  1161.     PORT_DIPSETTING(    0x80, "Normal" )
  1162.     PORT_DIPSETTING(    0xc0, "Hard" )
  1163.  
  1164.     PORT_START      /* IN4 */
  1165.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
  1166.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 )
  1167.     PORT_BIT( 0xfc, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  1168. INPUT_PORTS_END
  1169.  
  1170. INPUT_PORTS_START( guzzler )
  1171.     PORT_START      /* IN0 */
  1172.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_4WAY | IPF_COCKTAIL )
  1173.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT  | IPF_4WAY | IPF_COCKTAIL )
  1174.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP    | IPF_4WAY | IPF_COCKTAIL )
  1175.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN  | IPF_4WAY | IPF_COCKTAIL )
  1176.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_COCKTAIL )
  1177.     PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_UNKNOWN )   /* probably unused */
  1178.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )   /* probably unused */
  1179.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )   /* probably unused */
  1180.  
  1181.     PORT_START      /* IN1 */
  1182.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_4WAY )
  1183.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT  | IPF_4WAY )
  1184.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP    | IPF_4WAY )
  1185.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN  | IPF_4WAY )
  1186.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 )
  1187.     PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_UNKNOWN )   /* probably unused */
  1188.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )   /* probably unused */
  1189.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )   /* probably unused */
  1190.  
  1191.     PORT_START      /* DSW0 */
  1192.     PORT_DIPNAME( 0x03, 0x00, DEF_STR( Lives ) )
  1193.     PORT_DIPSETTING(    0x00, "3" )
  1194.     PORT_DIPSETTING(    0x01, "4" )
  1195.     PORT_DIPSETTING(    0x02, "5" )
  1196.     PORT_BITX( 0,       0x03, IPT_DIPSWITCH_SETTING | IPF_CHEAT, "64", IP_KEY_NONE, IP_JOY_NONE )
  1197.     PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Bonus_Life ) )
  1198.     PORT_DIPSETTING(    0x04, "20000 50000" )
  1199.     PORT_DIPSETTING(    0x00, "30000 100000" )
  1200.     PORT_DIPSETTING(    0x08, "30000" )
  1201.     PORT_DIPSETTING(    0x0c, "None" )
  1202.     PORT_DIPNAME( 0x30, 0x00, DEF_STR( Coin_A ) )
  1203.     PORT_DIPSETTING(    0x10, DEF_STR( 2C_1C ) )
  1204.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  1205.     PORT_DIPSETTING(    0x0020, DEF_STR( 1C_2C ) )
  1206.     PORT_DIPSETTING(    0x30, DEF_STR( 1C_3C ) )
  1207.     PORT_DIPNAME( 0xc0, 0x00, DEF_STR( Coin_B ) )
  1208.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  1209.     PORT_DIPSETTING(    0x40, DEF_STR( 1C_2C ) )
  1210.     PORT_DIPSETTING(    0x80, DEF_STR( 1C_3C ) )
  1211.     PORT_DIPSETTING(    0xc0, DEF_STR( 1C_6C ) )
  1212.  
  1213.     PORT_START      /* DSW1 */
  1214.     PORT_BIT( 0x0f, IP_ACTIVE_HIGH, IPT_UNKNOWN )     /* probably unused */
  1215.     PORT_DIPNAME( 0x10, 0x10, DEF_STR( Cabinet ) )
  1216.     PORT_DIPSETTING(    0x10, DEF_STR( Upright ) )
  1217.     PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
  1218.     PORT_DIPNAME( 0x0020, 0x00, "High Score Names" )
  1219.     PORT_DIPSETTING(    0x0020, "3 Letters" )
  1220.     PORT_DIPSETTING(    0x00, "10 Letters" )
  1221.     PORT_DIPNAME( 0xc0, 0x00, DEF_STR( Difficulty ) )
  1222.     PORT_DIPSETTING(    0x00, "Easy" )
  1223.     PORT_DIPSETTING(    0x40, "Medium" )
  1224.     PORT_DIPSETTING(    0x80, "Hard" )
  1225.     PORT_DIPSETTING(    0xc0, "Hardest" )
  1226.  
  1227.     PORT_START      /* coin */
  1228.     PORT_BIT_IMPULSE( 0x01, IP_ACTIVE_HIGH, IPT_COIN1, 2)
  1229.     PORT_BIT_IMPULSE( 0x02, IP_ACTIVE_HIGH, IPT_COIN2, 2)
  1230.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START1 )
  1231.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START2 )
  1232.     PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNKNOWN )     /* probably unused */
  1233. INPUT_PORTS_END
  1234.  
  1235.  
  1236.  
  1237. static struct GfxLayout swimmer_charlayout =
  1238. {
  1239.     8,8,    /* 8*8 characters */
  1240.     512,    /* 512 characters */
  1241.     3,      /* 3 bits per pixel */
  1242.     { 0, 512*8*8, 512*2*8*8 },      /* the bitplanes are separated */
  1243.     { 0, 1, 2, 3, 4, 5, 6, 7 },         /* characters are upside down */
  1244.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
  1245.     8*8     /* every char takes 8 consecutive bytes */
  1246. };
  1247.  
  1248. static struct GfxLayout swimmer_spritelayout =
  1249. {
  1250.     16,16,  /* 16*16 sprites */
  1251.     128,    /* 128 sprites */
  1252.     3,          /* 3 bits per pixel */
  1253.     { 0, 128*16*16, 128*2*16*16 },  /* the bitplanes are separated */
  1254.     { 0, 1, 2, 3, 4, 5, 6, 7,       /* pretty straightforward layout */
  1255.             8*8+0, 8*8+1, 8*8+2, 8*8+3, 8*8+4, 8*8+5, 8*8+6, 8*8+7 },
  1256.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
  1257.             16*8, 17*8, 18*8, 19*8, 20*8, 21*8, 22*8, 23*8 },
  1258.     32*8    /* every sprite takes 32 consecutive bytes */
  1259. };
  1260.  
  1261. static struct GfxDecodeInfo swimmer_gfxdecodeinfo[] =
  1262. {
  1263.     { REGION_GFX1, 0, &swimmer_charlayout,      0, 64 }, /* characters */
  1264.     { REGION_GFX1, 0, &swimmer_spritelayout,    0, 32 }, /* sprite set #1 */
  1265.     { REGION_GFX2, 0, &swimmer_charlayout,   64*8, 4 },  /* big sprite set */
  1266.     { -1 } /* end of array */
  1267. };
  1268.  
  1269.  
  1270.  
  1271. static struct AY8910interface swimmer_ay8910_interface =
  1272. {
  1273.     2,      /* 2 chips */
  1274.     4000000/2,    /* 2 MHz */
  1275.     { 25, 25 },
  1276.     { 0 },
  1277.     { 0 },
  1278.     { 0 },
  1279.     { 0 }
  1280. };
  1281.  
  1282.  
  1283.  
  1284. static struct MachineDriver machine_driver_swimmer =
  1285. {
  1286.     /* basic machine hardware */
  1287.     {
  1288.         {
  1289.             CPU_Z80,
  1290.             3072000,    /* 3.072 MHz */
  1291.             swimmer_readmem,swimmer_writemem,0,0,
  1292.             nmi_interrupt,1
  1293.         },
  1294.         {
  1295.             CPU_Z80 | CPU_AUDIO_CPU,
  1296.             4000000/2,    /* 2 MHz */
  1297.             sound_readmem,sound_writemem,0,sound_writeport,
  1298.             0,0,
  1299.             nmi_interrupt,4000000/16384 /* IRQs are triggered by the main CPU */
  1300.         }
  1301.     },
  1302.     60, DEFAULT_60HZ_VBLANK_DURATION,       /* frames per second, vblank duration */
  1303.     1,      /* 1 CPU slice per frame - interleaving is forced when a sound command is written */
  1304.     0,
  1305.  
  1306.     /* video hardware */
  1307.     32*8, 32*8, { 0*8, 32*8-1, 2*8, 30*8-1 },
  1308.     swimmer_gfxdecodeinfo,
  1309.     256+32+2,64*8+4*8,
  1310.     swimmer_vh_convert_color_prom,
  1311.  
  1312.     VIDEO_TYPE_RASTER|VIDEO_MODIFIES_PALETTE,
  1313.     0,
  1314.     cclimber_vh_start,
  1315.     cclimber_vh_stop,
  1316.     swimmer_vh_screenrefresh,
  1317.  
  1318.     /* sound hardware */
  1319.     0,0,0,0,
  1320.     {
  1321.         {
  1322.             SOUND_AY8910,
  1323.             &swimmer_ay8910_interface
  1324.         }
  1325.     }
  1326. };
  1327.  
  1328.  
  1329.  
  1330. ROM_START( swimmer )
  1331.     ROM_REGION( 0x10000, REGION_CPU1 )     /* 64k for code */
  1332.     ROM_LOAD( "sw1",          0x0000, 0x1000, 0xf12481e7 )
  1333.     ROM_LOAD( "sw2",          0x1000, 0x1000, 0xa0b6fdd2 )
  1334.     ROM_LOAD( "sw3",          0x2000, 0x1000, 0xec93d7de )
  1335.     ROM_LOAD( "sw4",          0x3000, 0x1000, 0x0107927d )
  1336.     ROM_LOAD( "sw5",          0x4000, 0x1000, 0xebd8a92c )
  1337.     ROM_LOAD( "sw6",          0x5000, 0x1000, 0xf8539821 )
  1338.     ROM_LOAD( "sw7",          0x6000, 0x1000, 0x37efb64e )
  1339.     ROM_LOAD( "sw8",          0x7000, 0x1000, 0x33d6001e )
  1340.  
  1341.     ROM_REGION( 0x10000, REGION_CPU2 )     /* 64k for sound board */
  1342.     ROM_LOAD( "sw12",         0x0000, 0x1000, 0x2eee9bcb )
  1343.  
  1344.     ROM_REGION( 0x3000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  1345.     ROM_LOAD( "sw15",         0x0000, 0x1000, 0x4f3608cb )  /* chars */
  1346.     ROM_LOAD( "sw14",         0x1000, 0x1000, 0x7181c8b4 )
  1347.     ROM_LOAD( "sw13",         0x2000, 0x1000, 0x2eb1af5c )
  1348.  
  1349.     ROM_REGION( 0x3000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  1350.     ROM_LOAD( "sw23",         0x0000, 0x0800, 0x9ca67e24 )  /* bigsprite data */
  1351.     ROM_RELOAD(               0x0800, 0x0800 )    /* Guzzler has larger ROMs */
  1352.     ROM_LOAD( "sw22",         0x1000, 0x0800, 0x02c10992 )
  1353.     ROM_RELOAD(               0x1800, 0x0800 )    /* Guzzler has larger ROMs */
  1354.     ROM_LOAD( "sw21",         0x2000, 0x0800, 0x7f4993c1 )
  1355.     ROM_RELOAD(               0x2800, 0x0800 )    /* Guzzler has larger ROMs */
  1356.  
  1357.     ROM_REGION( 0x0220, REGION_PROMS )
  1358.     ROM_LOAD( "8220.clr",     0x0000, 0x100, 0x72c487ed )
  1359.     ROM_LOAD( "8212.clr",     0x0100, 0x100, 0x39037799 )
  1360.     ROM_LOAD( "8221.clr",     0x0200, 0x020, 0x3b2deb3a )
  1361. ROM_END
  1362.  
  1363. ROM_START( swimmera )
  1364.     ROM_REGION( 0x10000, REGION_CPU1 )     /* 64k for code */
  1365.     ROM_LOAD( "swa1",         0x0000, 0x1000, 0x42c2b6c5 )
  1366.     ROM_LOAD( "swa2",         0x1000, 0x1000, 0x49bac195 )
  1367.     ROM_LOAD( "swa3",         0x2000, 0x1000, 0xa6d8cb01 )
  1368.     ROM_LOAD( "swa4",         0x3000, 0x1000, 0x7be75182 )
  1369.     ROM_LOAD( "swa5",         0x4000, 0x1000, 0x78f79573 )
  1370.     ROM_LOAD( "swa6",         0x5000, 0x1000, 0xfda9b311 )
  1371.     ROM_LOAD( "swa7",         0x6000, 0x1000, 0x7090e5ee )
  1372.     ROM_LOAD( "swa8",         0x7000, 0x1000, 0xab86efa9 )
  1373.  
  1374.     ROM_REGION( 0x10000, REGION_CPU2 )     /* 64k for sound board */
  1375.     ROM_LOAD( "sw12",         0x0000, 0x1000, 0x2eee9bcb )
  1376.  
  1377.     ROM_REGION( 0x3000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  1378.     ROM_LOAD( "sw15",         0x0000, 0x1000, 0x4f3608cb )  /* chars */
  1379.     ROM_LOAD( "sw14",         0x1000, 0x1000, 0x7181c8b4 )
  1380.     ROM_LOAD( "sw13",         0x2000, 0x1000, 0x2eb1af5c )
  1381.  
  1382.     ROM_REGION( 0x3000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  1383.     ROM_LOAD( "sw23",         0x0000, 0x0800, 0x9ca67e24 )  /* bigsprite data */
  1384.     ROM_RELOAD(               0x0800, 0x0800 )    /* Guzzler has larger ROMs */
  1385.     ROM_LOAD( "sw22",         0x1000, 0x0800, 0x02c10992 )
  1386.     ROM_RELOAD(               0x1800, 0x0800 )    /* Guzzler has larger ROMs */
  1387.     ROM_LOAD( "sw21",         0x2000, 0x0800, 0x7f4993c1 )
  1388.     ROM_RELOAD(               0x2800, 0x0800 )    /* Guzzler has larger ROMs */
  1389.  
  1390.     ROM_REGION( 0x0220, REGION_PROMS )
  1391.     ROM_LOAD( "8220.clr",     0x0000, 0x100, 0x72c487ed )
  1392.     ROM_LOAD( "8212.clr",     0x0100, 0x100, 0x39037799 )
  1393.     ROM_LOAD( "8221.clr",     0x0200, 0x020, 0x3b2deb3a )
  1394. ROM_END
  1395.  
  1396. ROM_START( guzzler )
  1397.     ROM_REGION( 0x10000, REGION_CPU1 )     /* 64k for code */
  1398.     ROM_LOAD( "guzz-01.bin",  0x0000, 0x2000, 0x58aaa1e9 )
  1399.     ROM_LOAD( "guzz-02.bin",  0x2000, 0x2000, 0xf80ceb17 )
  1400.     ROM_LOAD( "guzz-03.bin",  0x4000, 0x2000, 0xe63c65a2 )
  1401.     ROM_LOAD( "guzz-04.bin",  0x6000, 0x2000, 0x45be42f5 )
  1402.     ROM_LOAD( "guzz-16.bin",  0xe000, 0x2000, 0x61ee00b7 )
  1403.  
  1404.     ROM_REGION( 0x10000, REGION_CPU2 )     /* 64k for sound board */
  1405.     ROM_LOAD( "guzz-12.bin",  0x0000, 0x1000, 0xf3754d9e )
  1406.  
  1407.     ROM_REGION( 0x3000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  1408.     ROM_LOAD( "guzz-13.bin",  0x0000, 0x1000, 0xafc464e2 )   /* chars */
  1409.     ROM_LOAD( "guzz-14.bin",  0x1000, 0x1000, 0xacbdfe1f )
  1410.     ROM_LOAD( "guzz-15.bin",  0x2000, 0x1000, 0x66978c05 )
  1411.  
  1412.     ROM_REGION( 0x3000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  1413.     ROM_LOAD( "guzz-11.bin",  0x0000, 0x1000, 0xec2e9d86 )   /* big sprite */
  1414.     ROM_LOAD( "guzz-10.bin",  0x1000, 0x1000, 0xbd3f0bf7 )
  1415.     ROM_LOAD( "guzz-09.bin",  0x2000, 0x1000, 0x18927579 )
  1416.  
  1417.     ROM_REGION( 0x0220, REGION_PROMS )
  1418.     ROM_LOAD( "guzzler.003",  0x0000, 0x100, 0xf86930c1 )
  1419.     ROM_LOAD( "guzzler.002",  0x0100, 0x100, 0xb566ea9e )
  1420.     ROM_LOAD( "guzzler.001",  0x0200, 0x020, 0x69089495 )
  1421. ROM_END
  1422.  
  1423.  
  1424.  
  1425. GAME( 1980, cclimber, 0,        cclimber, cclimber, cclimber, ROT0,   "Nichibutsu", "Crazy Climber (US)" )
  1426. GAME( 1980, cclimbrj, cclimber, cclimber, cclimber, cclimbrj, ROT0,   "Nichibutsu", "Crazy Climber (Japan)" )
  1427. GAME( 1980, ccboot,   cclimber, cclimber, cclimber, cclimbrj, ROT0,   "bootleg", "Crazy Climber (bootleg set 1)" )
  1428. GAME( 1980, ccboot2,  cclimber, cclimber, cclimber, cclimbrj, ROT0,   "bootleg", "Crazy Climber (bootleg set 2)" )
  1429. GAME( 1981, ckong,    0,        cclimber, ckong,    0,        ROT270, "Falcon", "Crazy Kong (set 1)" )
  1430. GAME( 1981, ckonga,   ckong,    cclimber, ckong,    0,        ROT270, "Falcon", "Crazy Kong (set 2)" )
  1431. GAME( 1981, ckongjeu, ckong,    cclimber, ckong,    0,        ROT270, "bootleg", "Crazy Kong (Jeutel bootleg)" )
  1432. GAME( 1981, ckongo,   ckong,    cclimber, ckong,    0,        ROT270, "bootleg", "Crazy Kong (Orca bootleg)" )
  1433. GAME( 1981, ckongalc, ckong,    cclimber, ckong,    0,        ROT270, "bootleg", "Crazy Kong (Alca bootleg)" )
  1434. GAME( 1981, monkeyd,  ckong,    cclimber, ckong,    0,        ROT270, "bootleg", "Monkey Donkey" )
  1435. GAME( ????, rpatrolb, 0,        cclimber, rpatrolb, 0,        ROT0,   "bootleg", "River Patrol (bootleg)" )
  1436. GAME( ????, silvland, rpatrolb, cclimber, rpatrolb, 0,        ROT0,   "Falcon", "Silver Land" )
  1437.  
  1438. GAME( 1982, swimmer,  0,       swimmer, swimmer, 0, ROT0,  "Tehkan", "Swimmer (set 1)" )
  1439. GAME( 1982, swimmera, swimmer, swimmer, swimmer, 0, ROT0,  "Tehkan", "Swimmer (set 2)" )
  1440. GAME( 1983, guzzler,  0,       swimmer, guzzler, 0, ROT90, "Tehkan", "Guzzler" )
  1441.